package hotsaucerecipes

class AdminFilters {
    def filters = {
        adminOnly(controller: "(recipe|user)",
                action: "(create|edit|update|delete|save)") {
            before = {
                if (!session?.user?.admin) {
                    flash.message = "Sorry, admin only"
                    redirect(controller: "recipe", action: "list")
                    return false
                }
            }
        }
    }
}